import {createRouter, createWebHistory} from 'vue-router';
import Layout from '@/common/layout/Layout.vue';
import Index from '@/module/index/Index.vue';
import Login from '@/module/login/Login.vue';

//系统
const System = [
    {
        path: '/system/menu',
        component: () => import('@/module/system/SysMenu.vue'),
    },
    {
        path: '/system/api',
        component: () => import('@/module/system/SysAPI.vue'),
    },
    {
        path: '/system/role',
        component: () => import('@/module/system/SysRole.vue'),
    },
    {
        path: '/system/user',
        component: () => import('@/module/system/SysUser.vue'),
    },
    {
        path: '/system/userInfo',
        component: () => import('@/module/system/SysUserInfo.vue'),
    },
    {
        path: '/system/userSetting',
        component: () => import('@/module/system/SysUserSetting.vue'),
    },
    {
        path: '/system/work',
        component: () => import('@/module/system/WorkPlace.vue'),
    },
]

//定位业务
const Position = [
    //商场
    {
        path: '/position/market/marketAreaBasis',
        component: () => import('@/module/position/MarketAreaBasis.vue'),
    },
    {
        path: '/position/market/monitor',
        component: () => import('@/module/position/MarketMonitor.vue'),
    },
    //工厂
    {
        path: '/position/factory/factoryAreaBasis',
        component: () => import('@/module/position/FactoryAreaBasis.vue'),
    },
    {
        path: '/position/factory/monitor',
        component: () => import('@/module/position/FactoryMonitor.vue'),
    },
]


//Demo
const Demo = [
    {
        path: '/demo/fabricjs/freeDraw',
        component: () => import('@/module/demo/fabricjs/FreeDraw.vue'),
    },
]


export const routesConst = [
    {
        path: '/',
        redirect: "/index",
    },
    {
        path: '/index',
        component: Index,
    },
    // //
    ...System,
    // //
    ...Position,
    // //
    ...Demo
]

const routes = [
    {
        path: '/',
        component: Layout,
        redirect: "/index",
        children: routesConst
    },
    {
        path: '/public/login',
        component: Login,
    }
    ,
    {
        path: '/public/serverStop',
        component: () => import('@/module/system/ServerStop.vue'),
    }
]

export default createRouter({
    history: createWebHistory(),
    routes,
});


